package src;

public class Warrior {
	 private int health;
	 private int armor;
	 private int defense;
	 private int range;
	 private int damage;
	 private int speed;
	 private double attackSpeed;
	 private int cost;
	 private int xPosition;
	 private int yPosition;
	 
	 private boolean advancing;
	 private boolean holding;
	 private boolean retreating;
	 
	 protected int baseHealth;
	 protected int baseArmor;
	 protected int baseDefense;
	 protected int baseRange;
	 protected int baseDamage;
	 protected int baseSpeed;
	 protected double baseAttackSpeed;
	 protected int baseCost;
	 
	 double attTimer;
	 boolean onPlayersSide;
	 
	 public Warrior(int bH, int bA, int bD, int bR, int bDa, int bS, double bAS, int bC){
		baseHealth = bH;
		setHealth(baseHealth);
		baseArmor = bA;
		setArmor(baseArmor);
		baseDefense = bD;
		setDefense(baseDefense);
		baseRange = bR;
		setRange(baseRange);
		baseDamage = bDa;
		setDamage(baseDamage);
		baseSpeed = bS;
		setSpeed(baseSpeed);
		baseAttackSpeed = bAS;
		setAttackSpeed(baseAttackSpeed);
		baseCost = bC;
		setCost(baseCost);
		advance();
	 }
	 
	 public void setHealth(int newHealth){
		 health = newHealth;
	 }
	 
	 public int getHealth(){
		 return health;
	 }
	 
	 public void setArmor(int newArmor){
		 armor = newArmor;
	 }
	 
	 public int getArmor(){
		 return armor;
	 }
	 
	 public void setDefense(int newDefense){
		 defense = newDefense;
	 }
	 
	 public int getDefense(){
		 return defense;
	 }
	 
	 public void setRange(int newRange){
		 range = newRange;
	 }
	 
	 public int getRange(){
		 return range;
	 }
	 
	 public void setDamage(int newDamage){
		 damage = newDamage;
	 }
	 
	 public int getDamage(){
		 return damage;
	 }
	 
	 public void setSpeed(int newSpeed){
		 speed = newSpeed;
	 }
	 
	 public int getSpeed(){
		 return speed;
	 }
	 
	 public void setAttackSpeed(double newAttackSpeed){
		 attackSpeed = newAttackSpeed;
	 }
	 
	 public double getAttackSpeed(){
		 return attackSpeed;
	 }
	 
	 public void setCost(int newCost){
		 cost = newCost;
	 }
	 
	 public int getCost(){
		 return cost;
	 }
	 
	 public void setXPosition(int newXPosition){
		 xPosition = newXPosition;
	 }
	 
	 public int getXPosition(){
		 return xPosition;
	 }
	 public void setYPosition(int newYPosition){
		 yPosition = newYPosition;
	 }
	 
	 public int getYPosition(){
		 return yPosition;
	 }
	 
	 public void attack(Warrior E){
		 //Damage taken = Enemy Damage - (Armor * Defense) +- RandomNumber(-10 to 10)
		 int randomThing1 = (int) (Math.random() * 10);
		 int randomThing2 = (int) (Math.random() * -10);
		 int damageGiven = (getDamage() - (E.getArmor() * E.getDefense())) + randomThing1 + randomThing2;
		 int EHealth = E.getHealth();
		 EHealth -= damageGiven;
		 E.setHealth(EHealth);
		 attTimer = getAttackSpeed();
		 
	 }
	 
	 public void advance(){
		 advancing = true;
		 holding = false;
		 retreating = false;
	 }
	 
	 public void holdPosition(){
		 advancing = false;
		 holding = true;
		 retreating = false;
	 }
	 
	 public void retreat(){
		 advancing = false;
		 holding = false;
		 retreating = true;
	 }
	

}
